package com.whitlock.backend.controller;

import com.whitlock.backend.entity.TKUser;
import com.whitlock.backend.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Whitlock
 * @date 2020/7/9   11:31 上午
 */
@RestController
@CrossOrigin
public class LoginController {

    @Autowired
    UserService userService;

    /**
     * 登录成功返回token
     */
    @PostMapping("/login")
    public TKUser login(@RequestBody TKUser user) {
        return userService.login(user);
    }
}
